﻿using AutoMapper;
using CoreTools.Domain.Entity;
using CoreTools.DTO.MapperDto;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CoreTools.Controllers
{
    /// <summary>
    /// AutoMap 控制器
    /// </summary>
    [ApiController]
    [Route("[controller]")]
    public class AutoMapController : ControllerBase
    {

        private static UserInfoEntity userInfo = new UserInfoEntity() { UserName = "李专业", RealName = "李开发" };

        public AutoMapController()
        {
            
        }


        /// <summary>
        ///  获取用户的信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetPersonInfo")]
        public async Task<ObjectResult> GetPersonInfo()
        {
           
            var data = Mapper.Map<UserInfoDto>(userInfo);

            return new ObjectResult(data);
        }


    }
}
